#!/usr/bin/python

#!/usr/bin/python
# -*- coding: UTF-8 -*-

# subversion info:
# $HeadURL: $
# $Author: $
# $Id: $
# $Revision: $

# External imports
import sys
import os.path
import ConfigParser

# Internal imports
from Feedtorrent.Feed import Feed
from Feedtorrent.TorrentParser import TorrentParser
from Feedtorrent.RSS import RSS
from Feedtorrent.Model import Episode, Event, DOWNLOADING


if __name__ == '__main__':
  rawconfig = ConfigParser.SafeConfigParser()
  rawconfig.read([os.path.join('/etc', 'feedtorrent.cfg'), 'feedtorrent.cfg'])
  config = dict()
  for name, value in rawconfig.items('General'):
    if name.endswith('path'):
      value = os.path.expanduser(value)
    config[name] = value

  feed = Feed(config)
  feed.syncDB()

  torrentParser = TorrentParser(config)
  torrentParser.syncDB()

  if config.get('rssoutputpath'):
    rss = RSS(config)
    rss.syncDB()

